import request from './request'

/**
 * 获取单词列表
 */
export const getWordList = (params) => {
  return request.get('/admin/words', { params })
}

/**
 * 获取单词详情
 */
export const getWordById = (id) => {
  return request.get(`/admin/words/${id}`)
}

/**
 * 创建单词
 */
export const createWord = (data) => {
  return request.post('/admin/words', data)
}

/**
 * 更新单词
 */
export const updateWord = (id, data) => {
  return request.put(`/admin/words/${id}`, data)
}

/**
 * 删除单词
 */
export const deleteWord = (id) => {
  return request.delete(`/admin/words/${id}`)
}

/**
 * 批量导入单词
 */
export const importWords = (file) => {
  const formData = new FormData()
  formData.append('file', file)
  return request.post('/admin/words/import', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

